home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 April / macformat-023.iso / Shareware City / Developers / NeoPersist 3.0.8 folder / NeoIncludes / CNeoIOBlock.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-10-27  |  1.5 KB  |  58 lines  |  [TEXT/MMCC]

  1. /****
  2.  * CNeoIOBlock.h
  3.  *
  4.  *    Declarations used by C++ and assembly code.
  5.  *
  6.  *    Copyright © Neologic Systems 1992-1994. All rights reserved
  7.  *
  8.  ****/
  9.  
  10. #ifndef __CNeoIOBlockH__
  11. #define __CNeoIOBlockH__ 1
  12.  
  13. #include <stddef.h>
  14.  
  15. // #define qNeoAsyncIO 1
  16.  
  17. #include <Files.h>
  18.  
  19. enum {        kNeoIOBlockCount        = 20};
  20. enum {        kNeoBufferLength        = 1024};
  21.  
  22. class CNeoContainerStream;
  23.  
  24. class CNeoIOBlock {
  25. public:
  26.                         CNeoIOBlock(void);
  27.     char *                getBuffer(void) {return fBuffer;}
  28.     long                getOffset(void) const {return fOffset;}
  29.     static CNeoIOBlock *GetOne(CNeoContainerStream *aStream, const Boolean aReading);
  30.     void                release(void);
  31.     void                setOffset(const long aOffset) {fOffset = aOffset;}
  32.  
  33. #if defined(qNeoPowerPC) || defined(qNeoIBMPC)
  34.     static long            SetupGlobals(const long aGlobals) {return 1;}
  35. #else
  36.     static long            SetupGlobals(const long aGlobals) {return SetA5(aGlobals);}
  37. #endif
  38.  
  39.     long                getGlobals(void) {return fGlobals;}
  40.     static CNeoIOBlock *GetIOBlock(NeoIOParams *aIOParams) {return (CNeoIOBlock *)((char *)aIOParams - offsetof(CNeoIOBlock, fPB));}
  41.     ParamBlockRec *        getIOPBlock(void) {return &fPB;}
  42.     void                setGlobals(const long aBase) {fGlobals = aBase;}
  43.  
  44.     NeoIOParams            fPB;
  45.     long                fGlobals;
  46.     Boolean                fReading;
  47.     CNeoContainerStream *
  48.                         fStream;
  49.     long                fOffset;
  50.     char                fBuffer[kNeoBufferLength];
  51. };
  52.  
  53. //    In fact, this should be a static member of CNeoIOBlock class,
  54. //    but we cannot do that due to a bug in Borland C++ compiler.
  55. extern CNeoIOBlock    FIOBlocks[kNeoIOBlockCount];
  56.  
  57. #endif
  58.